From 0af2914bd923dbd3478df13954a274a0414ab1a8 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 2 Jun 2017 09:15:11 -0700 Subject: [PATCH] Don't spawn threads for fresh work On "fresh" builds this ends up just wasting a lot of time! --- src/cargo/ops/cargo_rustc/job_queue.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cargo/ops/cargo_rustc/job_queue.rs b/src/cargo/ops/cargo_rustc/job_queue.rs index 7bb3e35e1..fa008289d 100644 --- a/src/cargo/ops/cargo_rustc/job_queue.rs +++ b/src/cargo/ops/cargo_rustc/job_queue.rs @@ -294,12 +294,16 @@ impl<'a> JobQueue<'a> { *self.counts.get_mut(key.pkg).unwrap() -= 1; let my_tx = self.tx.clone(); - scope.spawn(move || { + let doit = move || { let res = job.run(fresh, &JobState { tx: my_tx.clone(), }); my_tx.send(Message::Finish(key, res)).unwrap(); - }); + }; + match fresh { + Freshness::Fresh => doit(), + Freshness::Dirty => { scope.spawn(doit); } + } // Print out some nice progress information self.note_working_on(config, &key, fresh)?; -- 2.30.2